<!DOCTYPE html>
<!--加这个标签以后才可以对model模型进行解析-->
<html xmlns:th="http://www.thymeleaf.org" >
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>发布 - PCF社区</title>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="css/commnuity.css">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
</head>
<script type="application/javascript">
    //加载页面完成之后 触发此函数
    window.onload = function () {
        var closable = window.localStorage.getItem("closable");
        if (closable == "true"){
            window.close();
            window.localStorage.removeItem("closable");
        }
    }
</script>
<body>
<!-- 导航栏部分引用 -->
<div th:insert="~{navigation :: nav}"></div>

<!-- 图标class glyphicon glyphicon-list -->
<nav class="navbar navbar-default">
    <div class="container-fluid" id="left_main">
        <div class="row">
            <!--左侧文章部分-->
            <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
                <h3><span class="class glyphicon glyphicon-list" aria-hidden="true"/>发现</h3>
                <hr>
                <!-- 文章列表部分 -->
                <!--/*@thymesVar id="info" type="com.xuan.forum.dto.QuestionDto"*/-->
                <div th:if="${pagination.data != null}" th:each="info,infoStat :${pagination.data}" >
                    <div class="media" style="margin-top: 30px">
                        <div class="media-left media-middle">
                            <a href="#">
                                <!--/*@thymesVar id="user" type="com.xuan.forum.model.User"*/-->
                                <img class="media-object img-rounded" style="width: 40px"
                                     th:src="${info.user.avatarUrl}" alt="..."/>
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading" >
                                <a  th:text="${info.title}" th:href="@{'/question/'+ ${info.id} }"></a>
                            </h4>
                            <!--问题描述注释-->
<!--                            <span th:if="${info.description.length() > 20}" th:text="${info.description.substring(0,10)} + '........'" ></span>-->
<!--                            <span th:if="${info.description.length() <= 20}" th:text="${info.description} " ></span>-->
<!--                            <br>-->
                            <span class="test_desc">
                        <span th:text="${info.commentCount}"></span>个回复 ·  <span th:text="${info.viewCout}"></span>次浏览 ·
                                问题发布时间<span th:text="${#dates.format(info.getDateByLong(info.gmtCreate), 'yyyy-mm-dd hh:mm:ss')}" ></span> ·
                                最新评论时间<span th:text="${#dates.format(info.getDateByLong(info.gmtModified), 'yyyy-mm-dd hh:mm:ss')}" ></span>
                        </span>
                        </div>
                    </div>
                </div>

                <div th:if="${pagination.data == null}">
                    <h2>当前还没有问题，赶快登录发起问题吧！！！！！</h2>
                </div>
                <!-- 文章列表结束 -->
            </div>
            <!-- 左边文章部分结束 -->

            <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
                <h3>热门标签</h3>
                <ul class="list-group">
                    <li  th:each="hot,hotStat :${hotTags}" >
                    <a th:href="@{/(page = 1,tag=${hot}) }" th:text="${hot}"></a>
                    </li>
                </ul>
            </div>
        </div>

        <div class="row" style="margin: 0 auto">
            <!--  文章下方分页列表开始 -->
            <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12" >
                <ul class="pagination">
                    <li th:if="${pagination.showFirsPage}" ><a th:href="@{/(page = 1,serach=${serach}) }" >首页</a></li>
                    <li th:if="${pagination.showPrevious}" ><a th:href="@{/(page= ${pagination.page -1},serach=${serach}) }" >上一页</a></li>

                    <li   th:each="info,infoState :${pagination.pages}" th:class="${pagination.page == info} ? 'active' : '' " >
                        <a th:href="@{/(page=${info},serach=${serach})}" th:text="${info}" ></a>
                    </li>
<!--                    <li th:if="${pagination.showNext}"><a th:href="@{'/?page=' + ${pagination.page +1} }" >下一页</a></li>-->
                    <li th:if="${pagination.showNext}"><a th:href="@{/(page = ${pagination.page +1},serach=${serach}) }" >下一页</a></li>
                    <li th:if="${pagination.showEndPage}"><a th:href="@{/(page=${pagination.totalPage},serach=${serach}) }"  >末页</a></li>
                </ul>
            </div>
            <!-- 文章下方分页列表结束 -->
        </div>
    </div>
</nav>

<!-- 页尾部分引用 -->
<div class="footer" th:insert="~{footer :: foot}"></div>

</body>
</html>